﻿<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DeptMgrUserControl.ascx.cs"
    Inherits="JM.JCY.SharePointComponent.UserManagement.DeptMgr.DeptMgrUserControl" %>
<%@ Register Src="../LeftMenu/LeftMenuUserControl.ascx" TagName="LeftMenuUserControl"
    TagPrefix="uc1" %>
<script type="text/javascript">
    $(document).ready(function () {
        var lbNewDept = $("#<%=lbNewDept.ClientID %>");
        lbNewDept.live('click', function () {
            location.href = "CreateDept.aspx";
            return false;
        });

        var lbSortDept = $("#<%=lbSortDept.ClientID %>");
        lbSortDept.live('click', function () {
            location.href = "DeptList.aspx";
            return false;
        });

        var lbSortMember = $("#<%=lbSortMember.ClientID %>");
        lbSortMember.live('click', function () {
            location.href = "MemberSortOrder.aspx";
            return false;
        });

        var lbRemove = $("#<%= lbRemove.ClientID %>");
        lbRemove.live('click', function () {
            var selected = CheckSelected("Remove");
            if (selected == true) {
                showConfirm('', '请确认要删除被选中的部门科室，一旦删除将无法恢复?', RemoveDeptDoCall, null, true);
            }
            return false;
        });




    });


    function RemoveDeptDoCall() {
        __doPostBack('DeleteDeptById', '');
    }



    function CheckSelected(operation) {
        var hfSelId = $("#<%= hfSelId.ClientID %>");
        var Ids = hfSelId.val();
        if (Ids == "") {
            if (operation == "Edit")
                showAlert('', "请至少选择一个部门科室.");
            else if (operation == "Remove")
                showAlert('', "请至少选择一个部门科室.");
            return false;
        }
        else {
            return true;
        }
    }

    function ClickSelectCheckBox(Id) {
        var hfSelId = $("#<%= hfSelId.ClientID %>");
        hfSelId.val(Id);
    }
</script>
<style type="text/css">
    div table.list
    {
        margin: 0px;
    }
</style>
<div>
    <table class="main">
        <tr>
            <td valign="top" width="25%" runat="server" id="tdLeftMenu">
                <uc1:leftmenuusercontrol id="LeftMenuUserControl1" runat="server" />
            </td>
            <td valign="top" width="75%" runat="server" id="tdContent">
                <table class="content" width="98%">
                    <tr>
                        <td style="padding: 5px;">
                            <table width="100%" class="title">
                                <tr>
                                    <td width="40%">
                                        <h2 class="title">
                                            部门科室管理</h2>
                                    </td>
                                    <td align="right" width="60%">
                                        <div id="div1">
                                            <asp:LinkButton ID="lbNewDept" runat="server" class="link">新建部门</asp:LinkButton>
                                            |
                                            <asp:LinkButton ID="lbSortDept" runat="server" class="link">部门排序</asp:LinkButton>
                                            |
                                            <asp:LinkButton ID="lbSortMember" runat="server" class="link">干警排序</asp:LinkButton>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                            <br />
                            <hr />
                            <table width="100%" class="title">
                                <tr>
                                    <td>
                                        <div id="content" style="padding-left: 7px">
                                            <asp:GridView ID="GridViewDeptList" runat="server" AutoGenerateColumns="false" CssClass="list"
                                                GridLines="None" OnRowDataBound="GridViewDeptList_RowDataBound" Width="100%"
                                                OnDataBound="GridViewDeptList_DataBound">
                                                <Columns>
                                                    <asp:TemplateField HeaderText="选择" HeaderStyle-Width="5%">
                                                        <ItemTemplate>
                                                            <input id="cbSelect" name="cbSelect" type="radio" value='<%# Eval("ID") %>' onclick="ClickSelectCheckBox(<%# Eval("ID") %>)" />
                                                            <asp:Label ID="lblId" runat="server" Text='<%# Eval("ID") %>' Visible="false"></asp:Label>
                                                        </ItemTemplate>
                                                        <HeaderStyle Width="5%"></HeaderStyle>
                                                    </asp:TemplateField>
                                                    <%--<asp:BoundField DataField="seqid" HeaderText="No" HeaderStyle-Width="4%" />--%>
                                                    <asp:BoundField DataField="DeptName" HeaderText="部门科室" HeaderStyle-Width="35%" HeaderStyle-HorizontalAlign="Left">
                                                        <HeaderStyle HorizontalAlign="Left" Width="35%"></HeaderStyle>
                                                    </asp:BoundField>
                                                    <asp:BoundField DataField="JobTitle" HeaderText="职位" HeaderStyle-Width="65%" HeaderStyle-HorizontalAlign="Left">
                                                        <HeaderStyle HorizontalAlign="Left" Width="65%"></HeaderStyle>
                                                    </asp:BoundField>
                                                </Columns>
                                            </asp:GridView>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                            <table width="100%" class="title">
                                <tr>
                                    <td align="left">
                                        <div id="divButtons">
                                            <asp:LinkButton ID="lbEdit" runat="server" class="link" OnClientClick="javascript:if(CheckSelected('Edit')==false)return false;"
                                                OnClick="lbEdit_Click">编辑</asp:LinkButton>
                                            |
                                            <asp:LinkButton ID="lbRemove" runat="server" class="link">删除</asp:LinkButton>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</div>
<asp:HiddenField ID="hfSelId" runat="server" />
<asp:HiddenField ID="hfOperation" runat="server" />
